/**
 * @description 自定义插件
 * @author 任一鸣
 */
import { Layout, Col, Row, Button } from 'ant-design-vue' // 按需引入 需在 babel.config.js 配置
import { BoxCenter, BoxSingleCenter, BoxSkin, BoxMagazine } from './box/index'
import { App } from 'vue'

interface ComponentType {
  [key: string]: any;
}

const antdComponents: ComponentType = {
  Layout,
  Col,
  Row,
  Button
}
const commonComponents: ComponentType = {
  BoxCenter,
  BoxSingleCenter,
  BoxSkin,
  BoxMagazine
}
const install = (app: App<Element>): void => {
  Object.keys(antdComponents).forEach(key => {
    app.use(antdComponents[key])
  })
  Object.keys(commonComponents).forEach(key => {
    app.component(commonComponents[key]['name'], commonComponents[key])
  })
}

const appUI = {
  install,
}

export default appUI
